package com.xdap.pg.exam.utils;

import lombok.extern.slf4j.Slf4j;

import java.util.Calendar;

@Slf4j
public class PGUtils {


    public static String getCurrentQuarterIndex() {
        Calendar calendar = Calendar.getInstance();
        int month = calendar.get(Calendar.MONTH) + 1;
        if (month >= 1 && month <= 3) {
            log.debug("当前 {}月,是第 [{}] 季度", month, 1);
            return "[\"Quarterly-1\"]";
        } else if (month >= 4 && month <= 6) {
            log.debug("当前 {}月,是第 [{}] 季度", month, 2);
            return "[\"Quarterly-2\"]";
        } else if (month >= 7 && month <= 9) {
            log.debug("当前 {}月,是第 [{}] 季度", month, 3);
            return "[\"Quarterly-3\"]";
        } else {
            log.debug("当前 {}月,是第 [{}] 季度", month, 4);
            return "[\"Quarterly-4\"]";
        }
    }

    public static String getCurrentYearIndex() {
        Calendar calendar = Calendar.getInstance();
        int month = calendar.get(Calendar.MONTH) + 1;
        if (month >= 1 && month <= 6) {
            log.debug("当前 {}月,是 [{}] 半年", month, "上");
            return "[\"Halfyear-1\"]";
        } else {
            log.debug("当前 {}月,是 [{}] 半年", month, "下");
            return "[\"Halfyear-2\"]";
        }
    }

    public static void main(String [] args) {
        PGUtils.getCurrentQuarterIndex();
        PGUtils.getCurrentYearIndex();
    }

}
